package model;

import java.util.ArrayList;
import java.util.HashMap;

public class SpeedVarValueList {

	public int idValue;
	public HashMap<String, Integer> internalMap = new HashMap<String, Integer>();

	public SpeedVarValueList(String term, ArrayList intValueList) {
		ArrayList<String> varList = StringAnalyser.getVarsList(StringAnalyser
				.getElementsInTermList(term));
		// connect Var- and value-list:
		for (int i = 0; i < varList.size(); i++) {
			String varId = varList.get(i);
			internalMap.put(varId, (Integer) intValueList.get(i));
		}
	}

	@Override
	public String toString() {
		return internalMap.toString();
	}

	public int getValue(String varName) {
		return internalMap.get(varName);
	}

	public void setValue(String id, int execute) {
		internalMap.put(id, execute);
		idValue=execute;
	}

	// public void updateValue(Value x) {
	// internalMap.put(x.id, x);
	// }

	public int getResult() {
		return internalMap.get(VarNameFactory.getCurrentId());
	}

}
